from distutils.command.install import INSTALL_SCHEMES

# Tell distutils to put the data_files in platform-specific installation
# locations. See here for an explanation:
# http://groups.google.com/group/comp.lang.python/browse_thread/thread/35ec7b2fed36eaec/2105ee4d9e8042cb
for scheme in INSTALL_SCHEMES.values():
            scheme['data'] = scheme['purelib']

from glob import glob
pkg_config = {
    'name': 'duetopia-thredds',
    'author': 'William Waites, Jo Walsh',
    'author_email': 'ww@styx.org, jo@frot.org',
    'url': 'http://irl.styx.org/thredds/',
    'description': 'Duetopia THREDDS Python Library',
    'long_description': """
Duetopia THREDDS Python Library
    """,
    'packages': ['duetopia', 'duetopia.thredds'],
    'data_files': [
                ('duetopia/thredds/xsl', glob('duetopia/thredds/xsl/*.xsl')),
    ],
    'license': 'GPL',
    'platforms': ['all'],
    'version': '0.1',
    'install_requires': ['lxml >= 0.9'],
}

if __name__ == '__main__':
    from distutils.core import setup
    from os import environ

    if "DUETOPIA_VERSION" in environ:
        pkg_config['version'] = environ["DUETOPIA_VERSION"]
    # Getting verison from SVN is a PITA
    #else:
    #    from duetopia.utils.svn import version
    #    pkg_config['version'] = 'r%s' % version()

    setup(**pkg_config)
